<template>
	<view class="nickinput">
		<view class="content">
			<view class="nickname">昵称
			  <input v-model="nickname1" style="margin-left: 10upx; color: #ACACAC;"></input>
			</view>
		</view>
		<button style="background-color: #3C6DD2;margin-top: 100upx;" @click="gainame">保存</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				name2:'',
				possword:'',
				uid1:'',
				nickname1:''
			};
		},
		methods:{
			getData () {
				uni.request({
					url:'http://xj.gccrw.cn/api/index/login',
					data:{
						name:this.name2,
						password:this.possword
					},
					method:'POST',
					success: (res) => {
// 						this.nickname = res.data.data.user.nickname;
// 						this.head = res.data.data.user.head;
// 						this.id1 = res.data.data.user.id;
					}
					
				})
			},
			gainame () {
				uni.request({
					url:'http://xj.gccrw.cn/api/user/saveInfo',
					data:{
						uid:this.uid1,
						head:'',
						nickname:this.nickname1
					},
					method:'POST',
					success: (res) => {
						uni.navigateBack({
							delta:1
						})
					}
				})
			}
		},
		onLoad (e) {
			console.log('-------555-----',e.uid);
			this.getData();
			this.name2 = e.name;
			this.possword = e.pw;
			this.uid1 = e.uid
		}
	}
</script>

<style>
.nickinput {
	width: 100%;
	height: 74upx;
}
.nickname {
	margin-left: 20upx;
	padding: 3upx;
	display: flex;
	color: #353535;
}
</style>
